<?php
$id=intval($_GET['id']);

$db=new db;
$db->connect();
$db->query("select * from blog_video where id=".$id);
if($db->num_rows()>0){
		$data=$db->fetchOne();
		if($data['status']==0){
			die("Video Chưa Được Duyệt");	
		}
		
		if($data['tag']!=''){
			$db->query("select * from blog_video where tag='".$data['tag']."' and id !=".$id." order by id asc limit 0,6");
			if($db->num_rows()>0){
			$data['tag_data']=$db->fetchAll();
			}
		}
		
	
		$db->query("select * from blog_video where upload_user='".$data['upload_user']."' and id !=".$id." order by id desc limit 0,6");
	
		if($db->num_rows()>4){
			$data['same_user']=$db->fetchAll();
			
		}
		$db->close();
		
		
		$data['infor']=video_get_infor($data['url']);
		$data['category']=video_get_category($data['category'],$data['subcategory']);
		
		
		
		
}else{
			die("Video Không  Tồn Tại");	
}

$db->close();

//VIEW -----
video_view($id);
//------

$data1['title']=web_title($data['name']);
$data1['keyword']=web_keyword($data['alias'].",".$data['name']);
$data1['mota']=web_des($data['name']);

loadview('template/header_video',$data1);
loadview("video/view",$data);
loadview('template/footer_video');
exit();